import type { RouteRecordRaw } from 'vue-router'
import  NavBar  from '@/components/nav-bar/index.vue'
import TabBar from '@/components/tab-bar/index.vue'

/**
 * 路由表配置数组
 */
const routes: RouteRecordRaw[] = [
  {
        path:'/',
        redirect:'/home'
  },
{
  path:'/home',
  components:{
    default:()=>import('../views/home/index.vue'),
    footer:TabBar,
  },
  meta:{
    title:'首页',
    icon:'home-o',
    inTabbar:true,
  }
},
{
  path:'/category',
  components:{
    header:NavBar,
    default:()=>import('../views/category/index.vue'),
    footer:TabBar
  },
  meta:{
    title:'分类',
    icon:'list-switch',
    inTabbar:true,
  }
},
{
  path:'/cart',
  components:{
    header:NavBar,
    default:()=>import('../views/cart/index.vue'),
    footer:TabBar,
  },
  meta:{
    title:'购物车',
    icon:'shopping-cart-o',
    inTabbar:true,
  }
}
,

{
  path:'/mine',
  components:{
    header:NavBar,
    default: () => import('../views/mine/index.vue'),
    footer: TabBar,
  },
  meta: {
    title: '我的',
    icon: 'user-o',
    inTabbar: true, // 标记当前项是需要在 tabbar 上渲染
  },

},
{
  path: '/login',
  components: {
    header: NavBar,
    default: () => import('../views/login/index.vue'),
  },
  meta: {
    title: '用户登录',
  },
},
{
  path: '/register',
  components: {
    header: NavBar,
    default: () => import('../views/register/index.vue'),
  },
  meta: {
    title: '用户注册',
  },
},
{
  path: '/list',
  components: {
    header: NavBar,
    default: () => import('../views/list/index.vue'),
  },
},
{
  path: '/detail',
  components: {
    header: NavBar,
    default: () => import('../views/detail/index.vue'),
  },
},
{
  path: '/search',
  components: {
    header: NavBar,
    default: () => import('../views/search/index.vue'),
  },
  meta: {
    title: '搜索',
  },
},
]

export default routes
